package com.itxx.thread;

public class ThreadDemo implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName() + "第" + i + "次打印:" + " HelloWorld ");
        }
    }
}

class MyThRead implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName() + "第" + i + "次打印:" + "Hello World");
        }
    }
}

class Demo {
    public static void main(String[] args) {
        ThreadDemo t = new ThreadDemo();
        MyThRead m = new MyThRead();
        Thread t1 = new Thread(t, "线程1");

        Thread m1 = new Thread(m, "线程2");
        t1.start();
        m1.start();
    }
}

